/*
 * @Description: 本单位、跨单位申请 表格
 * @Author: Rfan
 * @Date: 2022-03-21 19:01:08
 * @LastEditTime: 2023-02-06 14:29:36
 */

import type { FC } from 'react';
import classNames from 'classnames/bind';
import { Button, Space, Table } from 'antd';
import { useRightApplyContext } from '../contexts/RightApplyContext';
import { useFormatMessage } from '@/utils/intlHelpers';

import styles from '../styles/list.module.scss';

const cx = classNames.bind(styles);

const { Column } = Table;

const ArcTable: FC = () => {
  const formatMessage = useFormatMessage();
  const { activeArcList, loading } = useRightApplyContext();

  return (
    <div className={cx('apply-table')}>
      <Table dataSource={activeArcList || []} loading={loading} rowKey="id">
        <Column title="序号" dataIndex="id" key="id" align="center" />
        <Column title="档号" dataIndex="archiveNo" key="archiveNo" align="center" />
        <Column
          title="题名"
          dataIndex="title"
          key="title"
          align="center"
          render={(text) => <span dangerouslySetInnerHTML={{ __html: text }} />}
        />
        <Column title="全宗" dataIndex="fondsName" key="fondsName" align="center" />
        <Column title="类型" dataIndex="archiveTypeName" key="archiveTypeName" align="center" />
        <Column title="所属部门" dataIndex="departmentName" key="operateTime" align="center" />
        <Column title="密级" dataIndex="secret" key="secret" align="center" />
        <Column
          title={formatMessage('tableAction')}
          key="action"
          align="center"
          render={(_text, record: any) => (
            <Space>
              <Button type="link">查看</Button>
            </Space>
          )}
        />
      </Table>
    </div>
  );
};

export default ArcTable;
